Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
Recibo el error "Error de referencia no detectado: Firebase no está definido" cuando intento leer mis datos en Firebase

Recibo el error en la línea de código 43. ¿Dónde estoy haciendo mal? También la imagen de mi base de datos aquí: Esta es mi base de datos

 <script type="module"> import { initializeApp } from "https://www.gstatic.com/firebasejs/9.4.0/firebase-app.js"; import { getDatabase, set, ref, update } from "https://www.gstatic.com/firebasejs/9.4.0/firebase-database.js"; import { getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword, onAuthStateChanged, signOut } from "https://www.gstatic.com/firebasejs/9.4.0/firebase-auth.js"; const firebaseConfig = { apiKey: , authDomain: , databaseURL: , projectId: , storageBucket: , messagingSenderId: , appId: , measurementId: }; const app = initializeApp(firebaseConfig); const db = getDatabase(app); const auth = getAuth(); const firebaseRef = firebase.database().ref("Users"); firebaseRef.once("value", function(snapshot) { snapshot.forEach(function(element) { console.log(element); }) }); </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

firebase.database().ref() es la sintaxis de espacio de nombres (usada en V8 y antes) pero está usando Modular SDK (V9+). Intente refactorizar el código como se muestra a continuación usando las funciones ref() y get() :

 // ...imports // import { get, ref } from "https://www.gstatic.com/firebasejs/9.4.0/firebase-database.js" const app = initializeApp(firebaseConfig); const db = getDatabase(app); const auth = getAuth(app); const firebaseRef = ref(db, 'Users'); get(firebaseRef).then((snapshot) => { if (snapshot.exists()) { console.log(snapshot.val()); } else { console.log("No data available"); } }).catch((error) => { console.error(error); });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!